package com.huarun.common;

import java.io.Serializable;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;


@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)  
public class ResultObj <T> implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private int ErrorCode = 0;
	private String ErrorMessage = "success";
	private T Data;
	public int getErrorCode() {
		return ErrorCode;
	}

	public void setErrorCode(int errorCode) {
		ErrorCode = errorCode;
	}

	public String getErrorMessage() {
		return ErrorMessage;
	}

	public void setErrorMessage(String errorMessage) {
		ErrorMessage = errorMessage;
	}

	public T getData() {
		return Data;
	}

	public void setData(T data) {
		Data = data;
	}

	public void setCodeAndMsg(int code, String message){
		this.ErrorCode = code;
		this.ErrorMessage = message;
	}

	public static ResultObj createResultObj(ResultObj resultObj, int code, String message){		
		resultObj.ErrorMessage = message;
		resultObj.ErrorCode = code;
		return resultObj;	
	}
	
}
